/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'central';
  
  checkConfig(config);
  @endpoint = getEndpoint('resourcemanager', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AttachPolicyRequest {
  accountId?: string(name='AccountId'),
  policyName?: string(name='PolicyName'),
  policyType?: string(name='PolicyType'),
  principalName?: string(name='PrincipalName'),
  principalType?: string(name='PrincipalType'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model AttachPolicyResponseBody = {
  requestId?: string(name='RequestId'),
}

model AttachPolicyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AttachPolicyResponseBody(name='body'),
}

async function attachPolicyWithOptions(request: AttachPolicyRequest, runtime: Util.RuntimeOptions): AttachPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!Util.isUnset(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  if (!Util.isUnset(request.principalName)) {
    query['PrincipalName'] = request.principalName;
  }
  if (!Util.isUnset(request.principalType)) {
    query['PrincipalType'] = request.principalType;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AttachPolicy',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function attachPolicy(request: AttachPolicyRequest): AttachPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return attachPolicyWithOptions(request, runtime);
}

model CancelCreateCloudAccountRequest {
  recordId?: string(name='RecordId'),
}

model CancelCreateCloudAccountResponseBody = {
  requestId?: string(name='RequestId'),
}

model CancelCreateCloudAccountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CancelCreateCloudAccountResponseBody(name='body'),
}

async function cancelCreateCloudAccountWithOptions(request: CancelCreateCloudAccountRequest, runtime: Util.RuntimeOptions): CancelCreateCloudAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.recordId)) {
    query['RecordId'] = request.recordId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CancelCreateCloudAccount',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function cancelCreateCloudAccount(request: CancelCreateCloudAccountRequest): CancelCreateCloudAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return cancelCreateCloudAccountWithOptions(request, runtime);
}

model CancelPromoteResourceAccountRequest {
  recordId?: string(name='RecordId'),
}

model CancelPromoteResourceAccountResponseBody = {
  requestId?: string(name='RequestId'),
}

model CancelPromoteResourceAccountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CancelPromoteResourceAccountResponseBody(name='body'),
}

async function cancelPromoteResourceAccountWithOptions(request: CancelPromoteResourceAccountRequest, runtime: Util.RuntimeOptions): CancelPromoteResourceAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.recordId)) {
    query['RecordId'] = request.recordId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CancelPromoteResourceAccount',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function cancelPromoteResourceAccount(request: CancelPromoteResourceAccountRequest): CancelPromoteResourceAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return cancelPromoteResourceAccountWithOptions(request, runtime);
}

model CreateCloudAccountRequest {
  displayName?: string(name='DisplayName'),
  email?: string(name='Email'),
  enableConsolidatedBilling?: boolean(name='EnableConsolidatedBilling'),
  parentFolderId?: string(name='ParentFolderId'),
  payerAccountId?: string(name='PayerAccountId'),
}

model CreateCloudAccountResponseBody = {
  account?: {
    accountId?: string(name='AccountId'),
    accountName?: string(name='AccountName'),
    displayName?: string(name='DisplayName'),
    folderId?: string(name='FolderId'),
    joinMethod?: string(name='JoinMethod'),
    joinTime?: string(name='JoinTime'),
    modifyTime?: string(name='ModifyTime'),
    recordId?: string(name='RecordId'),
    resourceDirectoryId?: string(name='ResourceDirectoryId'),
    status?: string(name='Status'),
    type?: string(name='Type'),
  }(name='Account'),
  requestId?: string(name='RequestId'),
}

model CreateCloudAccountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateCloudAccountResponseBody(name='body'),
}

async function createCloudAccountWithOptions(request: CreateCloudAccountRequest, runtime: Util.RuntimeOptions): CreateCloudAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.displayName)) {
    query['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.enableConsolidatedBilling)) {
    query['EnableConsolidatedBilling'] = request.enableConsolidatedBilling;
  }
  if (!Util.isUnset(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!Util.isUnset(request.payerAccountId)) {
    query['PayerAccountId'] = request.payerAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCloudAccount',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createCloudAccount(request: CreateCloudAccountRequest): CreateCloudAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCloudAccountWithOptions(request, runtime);
}

model CreateFolderRequest {
  name?: string(name='Name'),
  parentFolderId?: string(name='ParentFolderId'),
}

model CreateFolderResponseBody = {
  folder?: {
    createDate?: string(name='CreateDate'),
    folderId?: string(name='FolderId'),
    name?: string(name='Name'),
    parentFolderId?: string(name='ParentFolderId'),
  }(name='Folder'),
  requestId?: string(name='RequestId'),
}

model CreateFolderResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateFolderResponseBody(name='body'),
}

async function createFolderWithOptions(request: CreateFolderRequest, runtime: Util.RuntimeOptions): CreateFolderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFolder',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createFolder(request: CreateFolderRequest): CreateFolderResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFolderWithOptions(request, runtime);
}

model CreatePolicyRequest {
  description?: string(name='Description'),
  policyDocument?: string(name='PolicyDocument'),
  policyName?: string(name='PolicyName'),
}

model CreatePolicyResponseBody = {
  policy?: {
    createDate?: string(name='CreateDate'),
    defaultVersion?: string(name='DefaultVersion'),
    description?: string(name='Description'),
    policyName?: string(name='PolicyName'),
    policyType?: string(name='PolicyType'),
  }(name='Policy'),
  requestId?: string(name='RequestId'),
}

model CreatePolicyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreatePolicyResponseBody(name='body'),
}

async function createPolicyWithOptions(request: CreatePolicyRequest, runtime: Util.RuntimeOptions): CreatePolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.policyDocument)) {
    query['PolicyDocument'] = request.policyDocument;
  }
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreatePolicy',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createPolicy(request: CreatePolicyRequest): CreatePolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPolicyWithOptions(request, runtime);
}

model CreatePolicyVersionRequest {
  policyDocument?: string(name='PolicyDocument'),
  policyName?: string(name='PolicyName'),
  setAsDefault?: boolean(name='SetAsDefault'),
}

model CreatePolicyVersionResponseBody = {
  policyVersion?: {
    createDate?: string(name='CreateDate'),
    isDefaultVersion?: boolean(name='IsDefaultVersion'),
    versionId?: string(name='VersionId'),
  }(name='PolicyVersion'),
  requestId?: string(name='RequestId'),
}

model CreatePolicyVersionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreatePolicyVersionResponseBody(name='body'),
}

async function createPolicyVersionWithOptions(request: CreatePolicyVersionRequest, runtime: Util.RuntimeOptions): CreatePolicyVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.policyDocument)) {
    query['PolicyDocument'] = request.policyDocument;
  }
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!Util.isUnset(request.setAsDefault)) {
    query['SetAsDefault'] = request.setAsDefault;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreatePolicyVersion',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createPolicyVersion(request: CreatePolicyVersionRequest): CreatePolicyVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPolicyVersionWithOptions(request, runtime);
}

model CreateResourceAccountRequest {
  displayName?: string(name='DisplayName'),
  enableConsolidatedBilling?: boolean(name='EnableConsolidatedBilling'),
  parentFolderId?: string(name='ParentFolderId'),
  payerAccountId?: string(name='PayerAccountId'),
}

model CreateResourceAccountResponseBody = {
  account?: {
    accountId?: string(name='AccountId'),
    accountName?: string(name='AccountName'),
    displayName?: string(name='DisplayName'),
    folderId?: string(name='FolderId'),
    joinMethod?: string(name='JoinMethod'),
    joinTime?: string(name='JoinTime'),
    modifyTime?: string(name='ModifyTime'),
    resourceDirectoryId?: string(name='ResourceDirectoryId'),
    status?: string(name='Status'),
    type?: string(name='Type'),
  }(name='Account'),
  requestId?: string(name='RequestId'),
}

model CreateResourceAccountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateResourceAccountResponseBody(name='body'),
}

async function createResourceAccountWithOptions(request: CreateResourceAccountRequest, runtime: Util.RuntimeOptions): CreateResourceAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.displayName)) {
    query['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.enableConsolidatedBilling)) {
    query['EnableConsolidatedBilling'] = request.enableConsolidatedBilling;
  }
  if (!Util.isUnset(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!Util.isUnset(request.payerAccountId)) {
    query['PayerAccountId'] = request.payerAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateResourceAccount',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createResourceAccount(request: CreateResourceAccountRequest): CreateResourceAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return createResourceAccountWithOptions(request, runtime);
}

model CreateResourceGroupRequest {
  accountId?: string(name='AccountId'),
  displayName?: string(name='DisplayName'),
  name?: string(name='Name'),
}

model CreateResourceGroupResponseBody = {
  requestId?: string(name='RequestId'),
  resourceGroup?: {
    accountId?: string(name='AccountId'),
    createDate?: string(name='CreateDate'),
    displayName?: string(name='DisplayName'),
    id?: string(name='Id'),
    name?: string(name='Name'),
    regionStatuses?: {
      regionStatus?: [ 
      {
        regionId?: string(name='RegionId'),
        status?: string(name='Status'),
      }
    ](name='RegionStatus')
    }(name='RegionStatuses'),
    status?: string(name='Status'),
  }(name='ResourceGroup'),
}

model CreateResourceGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateResourceGroupResponseBody(name='body'),
}

async function createResourceGroupWithOptions(request: CreateResourceGroupRequest, runtime: Util.RuntimeOptions): CreateResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.displayName)) {
    query['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateResourceGroup',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createResourceGroup(request: CreateResourceGroupRequest): CreateResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createResourceGroupWithOptions(request, runtime);
}

model CreateRoleRequest {
  assumeRolePolicyDocument?: string(name='AssumeRolePolicyDocument'),
  description?: string(name='Description'),
  maxSessionDuration?: long(name='MaxSessionDuration'),
  roleName?: string(name='RoleName'),
}

model CreateRoleResponseBody = {
  requestId?: string(name='RequestId'),
  role?: {
    arn?: string(name='Arn'),
    assumeRolePolicyDocument?: string(name='AssumeRolePolicyDocument'),
    createDate?: string(name='CreateDate'),
    description?: string(name='Description'),
    maxSessionDuration?: long(name='MaxSessionDuration'),
    roleId?: string(name='RoleId'),
    roleName?: string(name='RoleName'),
    rolePrincipalName?: string(name='RolePrincipalName'),
  }(name='Role'),
}

model CreateRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateRoleResponseBody(name='body'),
}

async function createRoleWithOptions(request: CreateRoleRequest, runtime: Util.RuntimeOptions): CreateRoleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.assumeRolePolicyDocument)) {
    query['AssumeRolePolicyDocument'] = request.assumeRolePolicyDocument;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.maxSessionDuration)) {
    query['MaxSessionDuration'] = request.maxSessionDuration;
  }
  if (!Util.isUnset(request.roleName)) {
    query['RoleName'] = request.roleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateRole',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createRole(request: CreateRoleRequest): CreateRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createRoleWithOptions(request, runtime);
}

model CreateServiceLinkedRoleRequest {
  customSuffix?: string(name='CustomSuffix'),
  description?: string(name='Description'),
  serviceName?: string(name='ServiceName'),
}

model CreateServiceLinkedRoleResponseBody = {
  requestId?: string(name='RequestId'),
  role?: {
    arn?: string(name='Arn'),
    assumeRolePolicyDocument?: string(name='AssumeRolePolicyDocument'),
    createDate?: string(name='CreateDate'),
    description?: string(name='Description'),
    isServiceLinkedRole?: boolean(name='IsServiceLinkedRole'),
    roleId?: string(name='RoleId'),
    roleName?: string(name='RoleName'),
    rolePrincipalName?: string(name='RolePrincipalName'),
  }(name='Role'),
}

model CreateServiceLinkedRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateServiceLinkedRoleResponseBody(name='body'),
}

async function createServiceLinkedRoleWithOptions(request: CreateServiceLinkedRoleRequest, runtime: Util.RuntimeOptions): CreateServiceLinkedRoleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.customSuffix)) {
    query['CustomSuffix'] = request.customSuffix;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['ServiceName'] = request.serviceName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateServiceLinkedRole',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createServiceLinkedRole(request: CreateServiceLinkedRoleRequest): CreateServiceLinkedRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createServiceLinkedRoleWithOptions(request, runtime);
}

model DeleteFolderRequest {
  folderId?: string(name='FolderId'),
}

model DeleteFolderResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteFolderResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteFolderResponseBody(name='body'),
}

async function deleteFolderWithOptions(request: DeleteFolderRequest, runtime: Util.RuntimeOptions): DeleteFolderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.folderId)) {
    query['FolderId'] = request.folderId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteFolder',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteFolder(request: DeleteFolderRequest): DeleteFolderResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteFolderWithOptions(request, runtime);
}

model DeleteInvalidCloudAccountRecordRequest {
  recordId?: string(name='RecordId'),
}

model DeleteInvalidCloudAccountRecordResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteInvalidCloudAccountRecordResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteInvalidCloudAccountRecordResponseBody(name='body'),
}

async function deleteInvalidCloudAccountRecordWithOptions(request: DeleteInvalidCloudAccountRecordRequest, runtime: Util.RuntimeOptions): DeleteInvalidCloudAccountRecordResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.recordId)) {
    query['RecordId'] = request.recordId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInvalidCloudAccountRecord',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteInvalidCloudAccountRecord(request: DeleteInvalidCloudAccountRecordRequest): DeleteInvalidCloudAccountRecordResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteInvalidCloudAccountRecordWithOptions(request, runtime);
}

model DeletePolicyRequest {
  policyName?: string(name='PolicyName'),
}

model DeletePolicyResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeletePolicyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeletePolicyResponseBody(name='body'),
}

async function deletePolicyWithOptions(request: DeletePolicyRequest, runtime: Util.RuntimeOptions): DeletePolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeletePolicy',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deletePolicy(request: DeletePolicyRequest): DeletePolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return deletePolicyWithOptions(request, runtime);
}

model DeletePolicyVersionRequest {
  policyName?: string(name='PolicyName'),
  versionId?: string(name='VersionId'),
}

model DeletePolicyVersionResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeletePolicyVersionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeletePolicyVersionResponseBody(name='body'),
}

async function deletePolicyVersionWithOptions(request: DeletePolicyVersionRequest, runtime: Util.RuntimeOptions): DeletePolicyVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!Util.isUnset(request.versionId)) {
    query['VersionId'] = request.versionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeletePolicyVersion',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deletePolicyVersion(request: DeletePolicyVersionRequest): DeletePolicyVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return deletePolicyVersionWithOptions(request, runtime);
}

model DeleteResourceGroupRequest {
  accountId?: string(name='AccountId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model DeleteResourceGroupResponseBody = {
  requestId?: string(name='RequestId'),
  resourceGroup?: {
    accountId?: string(name='AccountId'),
    createDate?: string(name='CreateDate'),
    displayName?: string(name='DisplayName'),
    id?: string(name='Id'),
    name?: string(name='Name'),
    regionStatuses?: {
      regionStatus?: [ 
      {
        regionId?: string(name='RegionId'),
        status?: string(name='Status'),
      }
    ](name='RegionStatus')
    }(name='RegionStatuses'),
    status?: string(name='Status'),
  }(name='ResourceGroup'),
}

model DeleteResourceGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteResourceGroupResponseBody(name='body'),
}

async function deleteResourceGroupWithOptions(request: DeleteResourceGroupRequest, runtime: Util.RuntimeOptions): DeleteResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteResourceGroup',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteResourceGroup(request: DeleteResourceGroupRequest): DeleteResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteResourceGroupWithOptions(request, runtime);
}

model DeleteRoleRequest {
  roleName?: string(name='RoleName'),
}

model DeleteRoleResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteRoleResponseBody(name='body'),
}

async function deleteRoleWithOptions(request: DeleteRoleRequest, runtime: Util.RuntimeOptions): DeleteRoleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.roleName)) {
    query['RoleName'] = request.roleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteRole',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteRole(request: DeleteRoleRequest): DeleteRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteRoleWithOptions(request, runtime);
}

model DeleteServiceLinkedRoleRequest {
  roleName?: string(name='RoleName'),
}

model DeleteServiceLinkedRoleResponseBody = {
  deletionTaskId?: string(name='DeletionTaskId'),
  requestId?: string(name='RequestId'),
}

model DeleteServiceLinkedRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteServiceLinkedRoleResponseBody(name='body'),
}

async function deleteServiceLinkedRoleWithOptions(request: DeleteServiceLinkedRoleRequest, runtime: Util.RuntimeOptions): DeleteServiceLinkedRoleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.roleName)) {
    query['RoleName'] = request.roleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteServiceLinkedRole',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteServiceLinkedRole(request: DeleteServiceLinkedRoleRequest): DeleteServiceLinkedRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteServiceLinkedRoleWithOptions(request, runtime);
}

model DestoryResourceDirectoryResponseBody = {
  requestId?: string(name='RequestId'),
}

model DestoryResourceDirectoryResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DestoryResourceDirectoryResponseBody(name='body'),
}

async function destoryResourceDirectoryWithOptions(runtime: Util.RuntimeOptions): DestoryResourceDirectoryResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'DestoryResourceDirectory',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function destoryResourceDirectory(): DestoryResourceDirectoryResponse {
  var runtime = new Util.RuntimeOptions{};
  return destoryResourceDirectoryWithOptions(runtime);
}

model DestroyResourceDirectoryResponseBody = {
  requestId?: string(name='RequestId'),
}

model DestroyResourceDirectoryResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DestroyResourceDirectoryResponseBody(name='body'),
}

async function destroyResourceDirectoryWithOptions(runtime: Util.RuntimeOptions): DestroyResourceDirectoryResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'DestroyResourceDirectory',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function destroyResourceDirectory(): DestroyResourceDirectoryResponse {
  var runtime = new Util.RuntimeOptions{};
  return destroyResourceDirectoryWithOptions(runtime);
}

model DetachPolicyRequest {
  accountId?: string(name='AccountId'),
  policyName?: string(name='PolicyName'),
  policyType?: string(name='PolicyType'),
  principalName?: string(name='PrincipalName'),
  principalType?: string(name='PrincipalType'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model DetachPolicyResponseBody = {
  requestId?: string(name='RequestId'),
}

model DetachPolicyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DetachPolicyResponseBody(name='body'),
}

async function detachPolicyWithOptions(request: DetachPolicyRequest, runtime: Util.RuntimeOptions): DetachPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!Util.isUnset(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  if (!Util.isUnset(request.principalName)) {
    query['PrincipalName'] = request.principalName;
  }
  if (!Util.isUnset(request.principalType)) {
    query['PrincipalType'] = request.principalType;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DetachPolicy',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function detachPolicy(request: DetachPolicyRequest): DetachPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return detachPolicyWithOptions(request, runtime);
}

model GetAccountSummaryRequest {
  accountId?: string(name='AccountId'),
}

model GetAccountSummaryResponseBody = {
  requestId?: string(name='RequestId'),
  summaryMap?: {
    attachedPoliciesPerGroupQuota?: int32(name='AttachedPoliciesPerGroupQuota'),
    attachedPoliciesPerRoleQuota?: int32(name='AttachedPoliciesPerRoleQuota'),
    attachedPoliciesPerUserQuota?: int32(name='AttachedPoliciesPerUserQuota'),
    attachedSystemPoliciesPerGroupQuota?: int32(name='AttachedSystemPoliciesPerGroupQuota'),
    attachedSystemPoliciesPerRoleQuota?: int32(name='AttachedSystemPoliciesPerRoleQuota'),
    attachedSystemPoliciesPerUserQuota?: int32(name='AttachedSystemPoliciesPerUserQuota'),
    policies?: int32(name='Policies'),
    policiesQuota?: int32(name='PoliciesQuota'),
    policySizeQuota?: int32(name='PolicySizeQuota'),
    resourceGroups?: int32(name='ResourceGroups'),
    resourceGroupsQuota?: int32(name='ResourceGroupsQuota'),
    roles?: int32(name='Roles'),
    rolesQuota?: int32(name='RolesQuota'),
    versionsPerPolicyQuota?: int32(name='VersionsPerPolicyQuota'),
  }(name='SummaryMap'),
}

model GetAccountSummaryResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAccountSummaryResponseBody(name='body'),
}

async function getAccountSummaryWithOptions(request: GetAccountSummaryRequest, runtime: Util.RuntimeOptions): GetAccountSummaryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAccountSummary',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAccountSummary(request: GetAccountSummaryRequest): GetAccountSummaryResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAccountSummaryWithOptions(request, runtime);
}

model GetFolderRequest {
  folderId?: string(name='FolderId'),
}

model GetFolderResponseBody = {
  folder?: {
    createDate?: string(name='CreateDate'),
    folderId?: string(name='FolderId'),
    name?: string(name='Name'),
    parentFolderId?: string(name='ParentFolderId'),
  }(name='Folder'),
  requestId?: string(name='RequestId'),
}

model GetFolderResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetFolderResponseBody(name='body'),
}

async function getFolderWithOptions(request: GetFolderRequest, runtime: Util.RuntimeOptions): GetFolderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.folderId)) {
    query['FolderId'] = request.folderId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetFolder',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getFolder(request: GetFolderRequest): GetFolderResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFolderWithOptions(request, runtime);
}

model GetPolicyRequest {
  language?: string(name='Language'),
  policyName?: string(name='PolicyName'),
  policyType?: string(name='PolicyType'),
}

model GetPolicyResponseBody = {
  policy?: {
    attachmentCount?: int32(name='AttachmentCount'),
    createDate?: string(name='CreateDate'),
    defaultVersion?: string(name='DefaultVersion'),
    description?: string(name='Description'),
    policyDocument?: string(name='PolicyDocument'),
    policyName?: string(name='PolicyName'),
    policyType?: string(name='PolicyType'),
    updateDate?: string(name='UpdateDate'),
  }(name='Policy'),
  requestId?: string(name='RequestId'),
}

model GetPolicyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetPolicyResponseBody(name='body'),
}

async function getPolicyWithOptions(request: GetPolicyRequest, runtime: Util.RuntimeOptions): GetPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!Util.isUnset(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetPolicy',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPolicy(request: GetPolicyRequest): GetPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPolicyWithOptions(request, runtime);
}

model GetPolicyVersionRequest {
  policyName?: string(name='PolicyName'),
  policyType?: string(name='PolicyType'),
  versionId?: string(name='VersionId'),
}

model GetPolicyVersionResponseBody = {
  policyVersion?: {
    createDate?: string(name='CreateDate'),
    isDefaultVersion?: boolean(name='IsDefaultVersion'),
    policyDocument?: string(name='PolicyDocument'),
    versionId?: string(name='VersionId'),
  }(name='PolicyVersion'),
  requestId?: string(name='RequestId'),
}

model GetPolicyVersionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetPolicyVersionResponseBody(name='body'),
}

async function getPolicyVersionWithOptions(request: GetPolicyVersionRequest, runtime: Util.RuntimeOptions): GetPolicyVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!Util.isUnset(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  if (!Util.isUnset(request.versionId)) {
    query['VersionId'] = request.versionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetPolicyVersion',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPolicyVersion(request: GetPolicyVersionRequest): GetPolicyVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPolicyVersionWithOptions(request, runtime);
}

model GetResourceDirectoryResponseBody = {
  requestId?: string(name='RequestId'),
  resourceDirectory?: {
    createDate?: string(name='CreateDate'),
    masterAccountId?: string(name='MasterAccountId'),
    masterAccountName?: string(name='MasterAccountName'),
    resourceDirectoryId?: string(name='ResourceDirectoryId'),
    rootFolderId?: string(name='RootFolderId'),
  }(name='ResourceDirectory'),
}

model GetResourceDirectoryResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetResourceDirectoryResponseBody(name='body'),
}

async function getResourceDirectoryWithOptions(runtime: Util.RuntimeOptions): GetResourceDirectoryResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'GetResourceDirectory',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getResourceDirectory(): GetResourceDirectoryResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResourceDirectoryWithOptions(runtime);
}

model GetResourceDirectoryAccountRequest {
  accountId?: string(name='AccountId'),
}

model GetResourceDirectoryAccountResponseBody = {
  account?: {
    accountId?: string(name='AccountId'),
    accountName?: string(name='AccountName'),
    displayName?: string(name='DisplayName'),
    folderId?: string(name='FolderId'),
    identityInformation?: string(name='IdentityInformation'),
    joinMethod?: string(name='JoinMethod'),
    joinTime?: string(name='JoinTime'),
    modifyTime?: string(name='ModifyTime'),
    resourceDirectoryId?: string(name='ResourceDirectoryId'),
    status?: string(name='Status'),
    type?: string(name='Type'),
  }(name='Account'),
  requestId?: string(name='RequestId'),
}

model GetResourceDirectoryAccountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetResourceDirectoryAccountResponseBody(name='body'),
}

async function getResourceDirectoryAccountWithOptions(request: GetResourceDirectoryAccountRequest, runtime: Util.RuntimeOptions): GetResourceDirectoryAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceDirectoryAccount',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getResourceDirectoryAccount(request: GetResourceDirectoryAccountRequest): GetResourceDirectoryAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResourceDirectoryAccountWithOptions(request, runtime);
}

model GetResourceGroupRequest {
  accountId?: string(name='AccountId'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model GetResourceGroupResponseBody = {
  requestId?: string(name='RequestId'),
  resourceGroup?: {
    accountId?: string(name='AccountId'),
    createDate?: string(name='CreateDate'),
    displayName?: string(name='DisplayName'),
    id?: string(name='Id'),
    name?: string(name='Name'),
    regionStatuses?: {
      regionStatus?: [ 
      {
        regionId?: string(name='RegionId'),
        status?: string(name='Status'),
      }
    ](name='RegionStatus')
    }(name='RegionStatuses'),
    status?: string(name='Status'),
  }(name='ResourceGroup'),
}

model GetResourceGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetResourceGroupResponseBody(name='body'),
}

async function getResourceGroupWithOptions(request: GetResourceGroupRequest, runtime: Util.RuntimeOptions): GetResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceGroup',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getResourceGroup(request: GetResourceGroupRequest): GetResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResourceGroupWithOptions(request, runtime);
}

model GetRoleRequest {
  language?: string(name='Language'),
  roleName?: string(name='RoleName'),
}

model GetRoleResponseBody = {
  requestId?: string(name='RequestId'),
  role?: {
    arn?: string(name='Arn'),
    assumeRolePolicyDocument?: string(name='AssumeRolePolicyDocument'),
    createDate?: string(name='CreateDate'),
    description?: string(name='Description'),
    isServiceLinkedRole?: boolean(name='IsServiceLinkedRole'),
    latestDeletionTask?: {
      createDate?: string(name='CreateDate'),
      deletionTaskId?: string(name='DeletionTaskId'),
    }(name='LatestDeletionTask'),
    maxSessionDuration?: long(name='MaxSessionDuration'),
    roleId?: string(name='RoleId'),
    roleName?: string(name='RoleName'),
    rolePrincipalName?: string(name='RolePrincipalName'),
    updateDate?: string(name='UpdateDate'),
  }(name='Role'),
}

model GetRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetRoleResponseBody(name='body'),
}

async function getRoleWithOptions(request: GetRoleRequest, runtime: Util.RuntimeOptions): GetRoleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  if (!Util.isUnset(request.roleName)) {
    query['RoleName'] = request.roleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRole',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getRole(request: GetRoleRequest): GetRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return getRoleWithOptions(request, runtime);
}

model GetServiceLinkedRoleDeletionStatusRequest {
  deletionTaskId?: string(name='DeletionTaskId'),
}

model GetServiceLinkedRoleDeletionStatusResponseBody = {
  reason?: {
    message?: string(name='Message'),
    roleUsages?: {
      roleUsage?: [ 
      {
        region?: string(name='Region'),
        resources?: {
          resource?: [ string ](name='Resource')
        }(name='Resources'),
      }
    ](name='RoleUsage')
    }(name='RoleUsages'),
  }(name='Reason'),
  requestId?: string(name='RequestId'),
  status?: string(name='Status'),
}

model GetServiceLinkedRoleDeletionStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetServiceLinkedRoleDeletionStatusResponseBody(name='body'),
}

async function getServiceLinkedRoleDeletionStatusWithOptions(request: GetServiceLinkedRoleDeletionStatusRequest, runtime: Util.RuntimeOptions): GetServiceLinkedRoleDeletionStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.deletionTaskId)) {
    query['DeletionTaskId'] = request.deletionTaskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetServiceLinkedRoleDeletionStatus',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getServiceLinkedRoleDeletionStatus(request: GetServiceLinkedRoleDeletionStatusRequest): GetServiceLinkedRoleDeletionStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getServiceLinkedRoleDeletionStatusWithOptions(request, runtime);
}

model GetServiceLinkedRoleTemplateRequest {
  serviceName?: string(name='ServiceName'),
}

model GetServiceLinkedRoleTemplateResponseBody = {
  requestId?: string(name='RequestId'),
  serviceLinkedRoleTemplate?: {
    multipleRolesAllowed?: boolean(name='MultipleRolesAllowed'),
    roleDescriptions?: {
      roleDescription?: [ 
      {
        description?: string(name='Description'),
        language?: string(name='Language'),
      }
    ](name='RoleDescription')
    }(name='RoleDescriptions'),
    roleNamePrefix?: string(name='RoleNamePrefix'),
    serviceName?: string(name='ServiceName'),
    systemPolicyName?: string(name='SystemPolicyName'),
  }(name='ServiceLinkedRoleTemplate'),
}

model GetServiceLinkedRoleTemplateResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetServiceLinkedRoleTemplateResponseBody(name='body'),
}

async function getServiceLinkedRoleTemplateWithOptions(request: GetServiceLinkedRoleTemplateRequest, runtime: Util.RuntimeOptions): GetServiceLinkedRoleTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.serviceName)) {
    query['ServiceName'] = request.serviceName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetServiceLinkedRoleTemplate',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getServiceLinkedRoleTemplate(request: GetServiceLinkedRoleTemplateRequest): GetServiceLinkedRoleTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return getServiceLinkedRoleTemplateWithOptions(request, runtime);
}

model InitResourceDirectoryResponseBody = {
  requestId?: string(name='RequestId'),
  resourceDirectory?: {
    createDate?: string(name='CreateDate'),
    masterAccountId?: string(name='MasterAccountId'),
    masterAccountName?: string(name='MasterAccountName'),
    resourceDirectoryId?: string(name='ResourceDirectoryId'),
    rootFolderId?: string(name='RootFolderId'),
  }(name='ResourceDirectory'),
}

model InitResourceDirectoryResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: InitResourceDirectoryResponseBody(name='body'),
}

async function initResourceDirectoryWithOptions(runtime: Util.RuntimeOptions): InitResourceDirectoryResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'InitResourceDirectory',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function initResourceDirectory(): InitResourceDirectoryResponse {
  var runtime = new Util.RuntimeOptions{};
  return initResourceDirectoryWithOptions(runtime);
}

model ListAccountRecordsForParentRequest {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  parentFolderId?: string(name='ParentFolderId'),
  queryKeyword?: string(name='QueryKeyword'),
}

model ListAccountRecordsForParentResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  records?: {
    record?: [ 
    {
      accountId?: string(name='AccountId'),
      accountName?: string(name='AccountName'),
      displayName?: string(name='DisplayName'),
      folderId?: string(name='FolderId'),
      joinMethod?: string(name='JoinMethod'),
      joinTime?: string(name='JoinTime'),
      modifyTime?: string(name='ModifyTime'),
      recordId?: string(name='RecordId'),
      resourceDirectoryId?: string(name='ResourceDirectoryId'),
      status?: string(name='Status'),
      type?: string(name='Type'),
    }
  ](name='Record')
  }(name='Records'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
}

model ListAccountRecordsForParentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAccountRecordsForParentResponseBody(name='body'),
}

async function listAccountRecordsForParentWithOptions(request: ListAccountRecordsForParentRequest, runtime: Util.RuntimeOptions): ListAccountRecordsForParentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!Util.isUnset(request.queryKeyword)) {
    query['QueryKeyword'] = request.queryKeyword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAccountRecordsForParent',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAccountRecordsForParent(request: ListAccountRecordsForParentRequest): ListAccountRecordsForParentResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAccountRecordsForParentWithOptions(request, runtime);
}

model ListAccountsRequest {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model ListAccountsResponseBody = {
  accounts?: {
    account?: [ 
    {
      accountId?: string(name='AccountId'),
      displayName?: string(name='DisplayName'),
      folderId?: string(name='FolderId'),
      joinMethod?: string(name='JoinMethod'),
      joinTime?: string(name='JoinTime'),
      modifyTime?: string(name='ModifyTime'),
      resourceDirectoryId?: string(name='ResourceDirectoryId'),
      status?: string(name='Status'),
      type?: string(name='Type'),
    }
  ](name='Account')
  }(name='Accounts'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
}

model ListAccountsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAccountsResponseBody(name='body'),
}

async function listAccountsWithOptions(request: ListAccountsRequest, runtime: Util.RuntimeOptions): ListAccountsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAccounts',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAccounts(request: ListAccountsRequest): ListAccountsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAccountsWithOptions(request, runtime);
}

model ListAccountsForParentRequest {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  parentFolderId?: string(name='ParentFolderId'),
  queryKeyword?: string(name='QueryKeyword'),
}

model ListAccountsForParentResponseBody = {
  accounts?: {
    account?: [ 
    {
      accountId?: string(name='AccountId'),
      displayName?: string(name='DisplayName'),
      folderId?: string(name='FolderId'),
      joinMethod?: string(name='JoinMethod'),
      joinTime?: string(name='JoinTime'),
      modifyTime?: string(name='ModifyTime'),
      resourceDirectoryId?: string(name='ResourceDirectoryId'),
      status?: string(name='Status'),
      type?: string(name='Type'),
    }
  ](name='Account')
  }(name='Accounts'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
}

model ListAccountsForParentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAccountsForParentResponseBody(name='body'),
}

async function listAccountsForParentWithOptions(request: ListAccountsForParentRequest, runtime: Util.RuntimeOptions): ListAccountsForParentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!Util.isUnset(request.queryKeyword)) {
    query['QueryKeyword'] = request.queryKeyword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAccountsForParent',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAccountsForParent(request: ListAccountsForParentRequest): ListAccountsForParentResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAccountsForParentWithOptions(request, runtime);
}

model ListAncestorsRequest {
  childId?: string(name='ChildId'),
}

model ListAncestorsResponseBody = {
  folders?: {
    folder?: [ 
    {
      createDate?: string(name='CreateDate'),
      folderId?: string(name='FolderId'),
      name?: string(name='Name'),
    }
  ](name='Folder')
  }(name='Folders'),
  requestId?: string(name='RequestId'),
}

model ListAncestorsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAncestorsResponseBody(name='body'),
}

async function listAncestorsWithOptions(request: ListAncestorsRequest, runtime: Util.RuntimeOptions): ListAncestorsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.childId)) {
    query['ChildId'] = request.childId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAncestors',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAncestors(request: ListAncestorsRequest): ListAncestorsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAncestorsWithOptions(request, runtime);
}

model ListFoldersForParentRequest {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  parentFolderId?: string(name='ParentFolderId'),
  queryKeyword?: string(name='QueryKeyword'),
}

model ListFoldersForParentResponseBody = {
  folders?: {
    folder?: [ 
    {
      createDate?: string(name='CreateDate'),
      folderId?: string(name='FolderId'),
      name?: string(name='Name'),
    }
  ](name='Folder')
  }(name='Folders'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
}

model ListFoldersForParentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListFoldersForParentResponseBody(name='body'),
}

async function listFoldersForParentWithOptions(request: ListFoldersForParentRequest, runtime: Util.RuntimeOptions): ListFoldersForParentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!Util.isUnset(request.queryKeyword)) {
    query['QueryKeyword'] = request.queryKeyword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFoldersForParent',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listFoldersForParent(request: ListFoldersForParentRequest): ListFoldersForParentResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFoldersForParentWithOptions(request, runtime);
}

model ListParentsRequest {
  childId?: string(name='ChildId'),
}

model ListParentsResponseBody = {
  folders?: {
    folder?: [ 
    {
      createDate?: string(name='CreateDate'),
      folderId?: string(name='FolderId'),
      name?: string(name='Name'),
    }
  ](name='Folder')
  }(name='Folders'),
  requestId?: string(name='RequestId'),
}

model ListParentsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListParentsResponseBody(name='body'),
}

async function listParentsWithOptions(request: ListParentsRequest, runtime: Util.RuntimeOptions): ListParentsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.childId)) {
    query['ChildId'] = request.childId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListParents',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listParents(request: ListParentsRequest): ListParentsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listParentsWithOptions(request, runtime);
}

model ListPoliciesRequest {
  language?: string(name='Language'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  policyType?: string(name='PolicyType'),
}

model ListPoliciesResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  policies?: {
    policy?: [ 
    {
      attachmentCount?: int32(name='AttachmentCount'),
      createDate?: string(name='CreateDate'),
      defaultVersion?: string(name='DefaultVersion'),
      description?: string(name='Description'),
      policyName?: string(name='PolicyName'),
      policyType?: string(name='PolicyType'),
      updateDate?: string(name='UpdateDate'),
    }
  ](name='Policy')
  }(name='Policies'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
}

model ListPoliciesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPoliciesResponseBody(name='body'),
}

async function listPoliciesWithOptions(request: ListPoliciesRequest, runtime: Util.RuntimeOptions): ListPoliciesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPolicies',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPolicies(request: ListPoliciesRequest): ListPoliciesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPoliciesWithOptions(request, runtime);
}

model ListPolicyAttachmentsRequest {
  accountId?: string(name='AccountId'),
  language?: string(name='Language'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  policyName?: string(name='PolicyName'),
  policyType?: string(name='PolicyType'),
  principalName?: string(name='PrincipalName'),
  principalType?: string(name='PrincipalType'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model ListPolicyAttachmentsResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  policyAttachments?: {
    policyAttachment?: [ 
    {
      attachDate?: string(name='AttachDate'),
      description?: string(name='Description'),
      policyName?: string(name='PolicyName'),
      policyType?: string(name='PolicyType'),
      principalName?: string(name='PrincipalName'),
      principalType?: string(name='PrincipalType'),
      resourceGroupId?: string(name='ResourceGroupId'),
    }
  ](name='PolicyAttachment')
  }(name='PolicyAttachments'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
}

model ListPolicyAttachmentsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPolicyAttachmentsResponseBody(name='body'),
}

async function listPolicyAttachmentsWithOptions(request: ListPolicyAttachmentsRequest, runtime: Util.RuntimeOptions): ListPolicyAttachmentsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!Util.isUnset(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  if (!Util.isUnset(request.principalName)) {
    query['PrincipalName'] = request.principalName;
  }
  if (!Util.isUnset(request.principalType)) {
    query['PrincipalType'] = request.principalType;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPolicyAttachments',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPolicyAttachments(request: ListPolicyAttachmentsRequest): ListPolicyAttachmentsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPolicyAttachmentsWithOptions(request, runtime);
}

model ListPolicyVersionsRequest {
  policyName?: string(name='PolicyName'),
  policyType?: string(name='PolicyType'),
}

model ListPolicyVersionsResponseBody = {
  policyVersions?: {
    policyVersion?: [ 
    {
      createDate?: string(name='CreateDate'),
      isDefaultVersion?: boolean(name='IsDefaultVersion'),
      versionId?: string(name='VersionId'),
    }
  ](name='PolicyVersion')
  }(name='PolicyVersions'),
  requestId?: string(name='RequestId'),
}

model ListPolicyVersionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPolicyVersionsResponseBody(name='body'),
}

async function listPolicyVersionsWithOptions(request: ListPolicyVersionsRequest, runtime: Util.RuntimeOptions): ListPolicyVersionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!Util.isUnset(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPolicyVersions',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPolicyVersions(request: ListPolicyVersionsRequest): ListPolicyVersionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPolicyVersionsWithOptions(request, runtime);
}

model ListResourceGroupsRequest {
  accountId?: string(name='AccountId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  status?: string(name='Status'),
}

model ListResourceGroupsResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  resourceGroups?: {
    resourceGroup?: [ 
    {
      accountId?: string(name='AccountId'),
      createDate?: string(name='CreateDate'),
      displayName?: string(name='DisplayName'),
      id?: string(name='Id'),
      name?: string(name='Name'),
      status?: string(name='Status'),
    }
  ](name='ResourceGroup')
  }(name='ResourceGroups'),
  totalCount?: int32(name='TotalCount'),
}

model ListResourceGroupsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListResourceGroupsResponseBody(name='body'),
}

async function listResourceGroupsWithOptions(request: ListResourceGroupsRequest, runtime: Util.RuntimeOptions): ListResourceGroupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResourceGroups',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listResourceGroups(request: ListResourceGroupsRequest): ListResourceGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listResourceGroupsWithOptions(request, runtime);
}

model ListRolesRequest {
  language?: string(name='Language'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model ListRolesResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  roles?: {
    role?: [ 
    {
      arn?: string(name='Arn'),
      createDate?: string(name='CreateDate'),
      description?: string(name='Description'),
      isServiceLinkedRole?: boolean(name='IsServiceLinkedRole'),
      latestDeletionTask?: {
        createDate?: string(name='CreateDate'),
        deletionTaskId?: string(name='DeletionTaskId'),
      }(name='LatestDeletionTask'),
      maxSessionDuration?: long(name='MaxSessionDuration'),
      roleId?: string(name='RoleId'),
      roleName?: string(name='RoleName'),
      rolePrincipalName?: string(name='RolePrincipalName'),
      updateDate?: string(name='UpdateDate'),
    }
  ](name='Role')
  }(name='Roles'),
  totalCount?: int32(name='TotalCount'),
}

model ListRolesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRolesResponseBody(name='body'),
}

async function listRolesWithOptions(request: ListRolesRequest, runtime: Util.RuntimeOptions): ListRolesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRoles',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRoles(request: ListRolesRequest): ListRolesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRolesWithOptions(request, runtime);
}

model ListRolesForServiceRequest {
  language?: string(name='Language'),
  service?: string(name='Service'),
}

model ListRolesForServiceResponseBody = {
  requestId?: string(name='RequestId'),
  roles?: {
    role?: [ 
    {
      arn?: string(name='Arn'),
      createDate?: string(name='CreateDate'),
      description?: string(name='Description'),
      isServiceLinkedRole?: boolean(name='IsServiceLinkedRole'),
      latestDeletionTask?: {
        createDate?: string(name='CreateDate'),
        deletionTaskId?: string(name='DeletionTaskId'),
      }(name='LatestDeletionTask'),
      maxSessionDuration?: long(name='MaxSessionDuration'),
      roleId?: string(name='RoleId'),
      roleName?: string(name='RoleName'),
      rolePrincipalName?: string(name='RolePrincipalName'),
      updateDate?: string(name='UpdateDate'),
    }
  ](name='Role')
  }(name='Roles'),
}

model ListRolesForServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListRolesForServiceResponseBody(name='body'),
}

async function listRolesForServiceWithOptions(request: ListRolesForServiceRequest, runtime: Util.RuntimeOptions): ListRolesForServiceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRolesForService',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listRolesForService(request: ListRolesForServiceRequest): ListRolesForServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRolesForServiceWithOptions(request, runtime);
}

model ListTrustedServiceStatusRequest {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
}

model ListTrustedServiceStatusResponseBody = {
  enabledServicePrincipals?: {
    enabledServicePrincipal?: [ 
    {
      enableTime?: string(name='EnableTime'),
      servicePrincipal?: string(name='ServicePrincipal'),
    }
  ](name='EnabledServicePrincipal')
  }(name='EnabledServicePrincipals'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
}

model ListTrustedServiceStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTrustedServiceStatusResponseBody(name='body'),
}

async function listTrustedServiceStatusWithOptions(request: ListTrustedServiceStatusRequest, runtime: Util.RuntimeOptions): ListTrustedServiceStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTrustedServiceStatus',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTrustedServiceStatus(request: ListTrustedServiceStatusRequest): ListTrustedServiceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTrustedServiceStatusWithOptions(request, runtime);
}

model MoveAccountRequest {
  accountId?: string(name='AccountId'),
  destinationFolderId?: string(name='DestinationFolderId'),
}

model MoveAccountResponseBody = {
  requestId?: string(name='RequestId'),
}

model MoveAccountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: MoveAccountResponseBody(name='body'),
}

async function moveAccountWithOptions(request: MoveAccountRequest, runtime: Util.RuntimeOptions): MoveAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.destinationFolderId)) {
    query['DestinationFolderId'] = request.destinationFolderId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'MoveAccount',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function moveAccount(request: MoveAccountRequest): MoveAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return moveAccountWithOptions(request, runtime);
}

model PromoteResourceAccountRequest {
  accountId?: string(name='AccountId'),
  email?: string(name='Email'),
}

model PromoteResourceAccountResponseBody = {
  recordId?: string(name='RecordId'),
  requestId?: string(name='RequestId'),
}

model PromoteResourceAccountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PromoteResourceAccountResponseBody(name='body'),
}

async function promoteResourceAccountWithOptions(request: PromoteResourceAccountRequest, runtime: Util.RuntimeOptions): PromoteResourceAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PromoteResourceAccount',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function promoteResourceAccount(request: PromoteResourceAccountRequest): PromoteResourceAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return promoteResourceAccountWithOptions(request, runtime);
}

model QueryResourceRequest {
  accountId?: string(name='AccountId'),
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  region?: string(name='Region'),
  resourceGroupId?: string(name='ResourceGroupId'),
  resourceId?: string(name='ResourceId'),
  resourceType?: string(name='ResourceType'),
  service?: string(name='Service'),
}

model QueryResourceResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageSize?: int32(name='PageSize'),
  requestId?: string(name='RequestId'),
  resources?: {
    resource?: [ 
    {
      createDate?: string(name='CreateDate'),
      regionId?: string(name='RegionId'),
      resourceGroupId?: string(name='ResourceGroupId'),
      resourceId?: string(name='ResourceId'),
      resourceType?: string(name='ResourceType'),
      service?: string(name='Service'),
    }
  ](name='Resource')
  }(name='Resources'),
  totalCount?: int32(name='TotalCount'),
}

model QueryResourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryResourceResponseBody(name='body'),
}

async function queryResourceWithOptions(request: QueryResourceRequest, runtime: Util.RuntimeOptions): QueryResourceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryResource',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryResource(request: QueryResourceRequest): QueryResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryResourceWithOptions(request, runtime);
}

model RemoveCloudAccountRequest {
  accountId?: string(name='AccountId'),
}

model RemoveCloudAccountResponseBody = {
  requestId?: string(name='RequestId'),
}

model RemoveCloudAccountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RemoveCloudAccountResponseBody(name='body'),
}

async function removeCloudAccountWithOptions(request: RemoveCloudAccountRequest, runtime: Util.RuntimeOptions): RemoveCloudAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RemoveCloudAccount',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function removeCloudAccount(request: RemoveCloudAccountRequest): RemoveCloudAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return removeCloudAccountWithOptions(request, runtime);
}

model ResendCreateCloudAccountEmailRequest {
  recordId?: string(name='RecordId'),
}

model ResendCreateCloudAccountEmailResponseBody = {
  recordId?: string(name='RecordId'),
  requestId?: string(name='RequestId'),
}

model ResendCreateCloudAccountEmailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ResendCreateCloudAccountEmailResponseBody(name='body'),
}

async function resendCreateCloudAccountEmailWithOptions(request: ResendCreateCloudAccountEmailRequest, runtime: Util.RuntimeOptions): ResendCreateCloudAccountEmailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.recordId)) {
    query['RecordId'] = request.recordId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResendCreateCloudAccountEmail',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function resendCreateCloudAccountEmail(request: ResendCreateCloudAccountEmailRequest): ResendCreateCloudAccountEmailResponse {
  var runtime = new Util.RuntimeOptions{};
  return resendCreateCloudAccountEmailWithOptions(request, runtime);
}

model ResendPromoteResourceAccountEmailRequest {
  recordId?: string(name='RecordId'),
}

model ResendPromoteResourceAccountEmailResponseBody = {
  recordId?: string(name='RecordId'),
  requestId?: string(name='RequestId'),
}

model ResendPromoteResourceAccountEmailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ResendPromoteResourceAccountEmailResponseBody(name='body'),
}

async function resendPromoteResourceAccountEmailWithOptions(request: ResendPromoteResourceAccountEmailRequest, runtime: Util.RuntimeOptions): ResendPromoteResourceAccountEmailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.recordId)) {
    query['RecordId'] = request.recordId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResendPromoteResourceAccountEmail',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function resendPromoteResourceAccountEmail(request: ResendPromoteResourceAccountEmailRequest): ResendPromoteResourceAccountEmailResponse {
  var runtime = new Util.RuntimeOptions{};
  return resendPromoteResourceAccountEmailWithOptions(request, runtime);
}

model SetDefaultPolicyVersionRequest {
  policyName?: string(name='PolicyName'),
  versionId?: string(name='VersionId'),
}

model SetDefaultPolicyVersionResponseBody = {
  requestId?: string(name='RequestId'),
}

model SetDefaultPolicyVersionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SetDefaultPolicyVersionResponseBody(name='body'),
}

async function setDefaultPolicyVersionWithOptions(request: SetDefaultPolicyVersionRequest, runtime: Util.RuntimeOptions): SetDefaultPolicyVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!Util.isUnset(request.versionId)) {
    query['VersionId'] = request.versionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SetDefaultPolicyVersion',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function setDefaultPolicyVersion(request: SetDefaultPolicyVersionRequest): SetDefaultPolicyVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return setDefaultPolicyVersionWithOptions(request, runtime);
}

model UpdateFolderRequest {
  folderId?: string(name='FolderId'),
  name?: string(name='Name'),
}

model UpdateFolderResponseBody = {
  requestId?: string(name='RequestId'),
}

model UpdateFolderResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateFolderResponseBody(name='body'),
}

async function updateFolderWithOptions(request: UpdateFolderRequest, runtime: Util.RuntimeOptions): UpdateFolderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.folderId)) {
    query['FolderId'] = request.folderId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateFolder',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateFolder(request: UpdateFolderRequest): UpdateFolderResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateFolderWithOptions(request, runtime);
}

model UpdateResourceGroupRequest {
  accountId?: string(name='AccountId'),
  newDisplayName?: string(name='NewDisplayName'),
  resourceGroupId?: string(name='ResourceGroupId'),
}

model UpdateResourceGroupResponseBody = {
  requestId?: string(name='RequestId'),
  resourceGroup?: {
    accountId?: string(name='AccountId'),
    createDate?: string(name='CreateDate'),
    displayName?: string(name='DisplayName'),
    id?: string(name='Id'),
    name?: string(name='Name'),
  }(name='ResourceGroup'),
}

model UpdateResourceGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateResourceGroupResponseBody(name='body'),
}

async function updateResourceGroupWithOptions(request: UpdateResourceGroupRequest, runtime: Util.RuntimeOptions): UpdateResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.newDisplayName)) {
    query['NewDisplayName'] = request.newDisplayName;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateResourceGroup',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateResourceGroup(request: UpdateResourceGroupRequest): UpdateResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateResourceGroupWithOptions(request, runtime);
}

model UpdateRoleRequest {
  newAssumeRolePolicyDocument?: string(name='NewAssumeRolePolicyDocument'),
  newDescription?: string(name='NewDescription'),
  newMaxSessionDuration?: long(name='NewMaxSessionDuration'),
  roleName?: string(name='RoleName'),
}

model UpdateRoleResponseBody = {
  requestId?: string(name='RequestId'),
  role?: {
    arn?: string(name='Arn'),
    assumeRolePolicyDocument?: string(name='AssumeRolePolicyDocument'),
    createDate?: string(name='CreateDate'),
    description?: string(name='Description'),
    maxSessionDuration?: long(name='MaxSessionDuration'),
    roleId?: string(name='RoleId'),
    roleName?: string(name='RoleName'),
    rolePrincipalName?: string(name='RolePrincipalName'),
    updateDate?: string(name='UpdateDate'),
  }(name='Role'),
}

model UpdateRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateRoleResponseBody(name='body'),
}

async function updateRoleWithOptions(request: UpdateRoleRequest, runtime: Util.RuntimeOptions): UpdateRoleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.newAssumeRolePolicyDocument)) {
    query['NewAssumeRolePolicyDocument'] = request.newAssumeRolePolicyDocument;
  }
  if (!Util.isUnset(request.newDescription)) {
    query['NewDescription'] = request.newDescription;
  }
  if (!Util.isUnset(request.newMaxSessionDuration)) {
    query['NewMaxSessionDuration'] = request.newMaxSessionDuration;
  }
  if (!Util.isUnset(request.roleName)) {
    query['RoleName'] = request.roleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateRole',
    version = '2016-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateRole(request: UpdateRoleRequest): UpdateRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateRoleWithOptions(request, runtime);
}

